package algotradingfx.strategies.svm;

import algotradingfx.data.TickData;
import algotradingfx.data.TickDataSet;
import algotradingfx.utils.Constants;
import algotradingfx.utils.FXAsset;
import atp.client.trading.strategies.StrategyPush;
import atp.commons.util.StrategyInfo;
import atp.commons.util.Tick;
import edu.berkeley.compbio.jlibsvm.kernel.GaussianRBFKernel;
import edu.berkeley.compbio.jlibsvm.regression.MutableRegressionProblemImpl;

public class SimpleSvmStrategy extends StrategyPush {

	private static final long serialVersionUID = 8772619827155308100L;
	private static final String STRATEGY_NAME = "SimpleSvmStrategy";
	private static final int RBF_RADIUS = 1;

	private TickDataSet trainingSet;

	public SimpleSvmStrategy(String ssID, String password) {
		super(new StrategyInfo(STRATEGY_NAME), ssID, password);

		// instantiate the KernelFunction that you want
		// set up some parameters in a new SvmParameter object
		// instantiate a concrete subclass of SvmProblem (binary, multiclass, or
		// regression), and populate it with training data
		// instantiate a concrete subclass of SVM, choosing a type appropriate
		// for your problem
		// Call SVM.train(problem) to yield a SolutionModel, which can be used
		// to make predictions
		GaussianRBFKernel kernel = new GaussianRBFKernel(RBF_RADIUS);
		MutableRegressionProblemImpl prob = new MutableRegressionProblemImpl(10);
	}

	@Override
	public void initialise() {
		declare(FXAsset.EURUSD.toString(), Constants.MOCK_BROKER);
	}

	@Override
	public boolean run(Object o) {
		if (o instanceof Tick) {
			Tick t = (Tick) o;
			trainingSet.add(new TickData(t));
		}
		return false;
	}
}
